Skip to content

Fix smoke-test-published-packages: 6 packages broken on v0.7.2#264

Merged
adamziel merged 2 commits intotrunkfrom
fix/smoke-test-published-packages
May 4, 2026
Merged

Fix smoke-test-published-packages: 6 packages broken on v0.7.2#264
adamziel merged 2 commits intotrunkfrom
fix/smoke-test-published-packages

Conversation

@adamziel
Copy link
Copy Markdown
Collaborator

@adamziel adamziel commented May 4, 2026

Summary

The nightly smoke-test-published-packages workflow has been failing on v0.7.2 against six packages — each for a different reason. None of these are caught by the in-monorepo PHPUnit suite because the bug only surfaces once the package is split off and consumers composer require it standalone.

Failing packages: blueprints, corsproxy, data-liberation, markdown, merge, polyfill.

What changed

Per-package fixes (see commit message for full reasoning):

  • blueprintsbin/blueprint.php had a hard-coded monorepo-relative path to vendor/autoload.php, and exposed CLI-only classes through the classmap. Now bin/ and Steps/scripts/ are excluded from the classmap, the CLI bootstrap probes multiple autoload locations and skips the require when composer's ClassLoader is already in scope, and the Symfony DependencyInjection bridge (which needs symfony/dependency-injection — not bundled) is excluded too.
  • corsproxy — PSR-4 mapped WordPress\\CORSProxy\\ to a tree whose classes are actually globally namespaced, so the classes never autoloaded. Switched to classmap + autoload.files for cors-proxy-functions.php, and fixed a phpcbf-introduced syntax error on line 394 that the file hits as soon as it's actually loaded.
  • data-liberationDataLiberationHTMLProcessor extends WP_HTML_Processor but the package didn't depend on wp-php-toolkit/html. Added the dep.
  • markdown — vendored symfony/yaml and webuni/front-matter ship optional integrations (Console-based LintCommand, Twig/Haml/Pug filters) that need packages we don't bundle. Those subdirs are now excluded from the classmap.
  • merge — required the non-existent wordpress/data-liberation:dev-trunk and pulled in yetanotherape/diff-match-patch as a Composer dep even though it's already in vendor-patched/. Replaced both with the toolkit's own wp-php-toolkit/data-liberation, dropped to php: >=7.2 to match the project floor.
  • polyfillwordpress.php was loaded eagerly via autoload.files and declared WP_Error at composer-bootstrap time, which fatals as soon as a consumer also boots WordPress (the exact regression bin/check-wp-coexistence.php was added to catch). WP_Error and WP_Exception now live in classmap-loaded class-*.php files so they're declared lazily, and the missing php-functions.php entry was added to standalone autoload.files.

The smoke check itself was tightened so it doesn't false-positive against the new excludes:

  • bin/check-package-autoload.php now reads each package's autoload.exclude-from-classmap and skips those paths during the symbol scan.
  • The root composer.json's autoload was brought in line with the per-component config (CORSProxy/Polyfill in classmap, cors-proxy-functions.php in autoload.files, bogus WordPress\\CORSProxy\\ PSR-4 mapping removed).

Test plan

  • Local replay of the smoke workflow against all 17 packages using path-repository copies of components/ reports OK on every package
  • composer lint -- -n clean
  • composer test --testsuite "Project Test Suite" (the fast non-Blueprints suite) passes
  • CI matrix (PHPCS + PHPUnit) green on this PR
  • After merge, manual Publish workflow run cuts a new tag — the chained smoke-published-packages job should pass against the freshly-cut tag

🤖 Generated with Claude Code

adamziel added 2 commits May 4, 2026 15:19
The nightly smoke-test-published-packages workflow has been failing on
v0.7.2 against six packages. Each one had a different reason for not
working when installed standalone via `composer require`:

  - blueprints: bin/blueprint.php hard-coded a monorepo-relative path to
    vendor/autoload.php and exposed CLI-only classes through the classmap,
    so any consumer that triggered autoload of those classes hit the bad
    require. Excluded bin/ and Steps/scripts/ from the classmap, made the
    CLI bootstrap try multiple autoload locations and skip the require if
    composer's ClassLoader is already in scope, and excluded the
    Symfony event-dispatcher/DependencyInjection bridge that depends on
    symfony/dependency-injection (not bundled).
  - corsproxy: PSR-4 autoload mapped WordPress\\CORSProxy\\ to a tree
    whose classes are actually declared in the global namespace, so the
    classes never autoloaded. Switched to classmap + an autoload.files
    entry for cors-proxy-functions.php, and fixed a phpcbf-introduced
    syntax error on line 394 that this file hits as soon as it's actually
    loaded.
  - data-liberation: DataLiberationHTMLProcessor extends WP_HTML_Processor
    but the package didn't depend on wp-php-toolkit/html. Added the dep.
  - markdown: vendored symfony/yaml and webuni/front-matter ship optional
    integrations (Console-based LintCommand, Twig/Haml/Pug filters) that
    require packages we don't bundle. Excluded those subdirs from the
    classmap.
  - merge: required the non-existent `wordpress/data-liberation:dev-trunk`
    and pulled in `yetanotherape/diff-match-patch` as a Composer dep even
    though the package is already in vendor-patched/. Replaced both with
    the toolkit's own data-liberation, dropped to PHP >=7.2 to match the
    project floor.
  - polyfill: wordpress.php was loaded eagerly via autoload.files and
    declared WP_Error at composer-bootstrap time, which fatals as soon as
    a consumer also boots WordPress (this is exactly what
    bin/check-wp-coexistence.php was added to catch). Moved WP_Error and
    WP_Exception into classmap-loaded class-*.php files so they're
    declared lazily, and added the missing php-functions.php entry to
    the standalone autoload.files list.

The smoke check itself was tightened in two places:
  - bin/check-package-autoload.php now reads each package's
    autoload.exclude-from-classmap and skips those paths during the
    symbol scan, so excluding files from the classmap (CLI entry points,
    optional integrations) doesn't trigger false-positive "unreachable
    via autoload" failures.
  - The root composer.json's autoload was brought in line with the
    per-component config: components/CORSProxy/ and components/Polyfill/
    are now in the classmap, cors-proxy-functions.php is in
    autoload.files, and the bogus WordPress\\CORSProxy\\ PSR-4 entry
    is gone.

Local replay of the smoke workflow against all 17 packages (using path
repositories of the components/) now reports OK on every package.
The PHPUnit matrix uses composer-ci-matrix-tests.json (a parallel
autoload config to root composer.json), which had not been updated
alongside it. Without components/Polyfill/ in its classmap, the
WP_Error and WP_Exception classes that were just moved into
class-*.php files are not autoloadable in CI, causing every test
that references WP_Error from DataLiberation to fail.

Mirrors the root composer.json change: adds components/Polyfill/ and
components/CORSProxy/ to classmap, drops the bogus WordPress\\CORSProxy\\
PSR-4 entry, and adds php-functions.php / cors-proxy-functions.php
to autoload.files.
@adamziel adamziel merged commit 605de92 into trunk May 4, 2026
28 of 29 checks passed
@adamziel adamziel deleted the fix/smoke-test-published-packages branch May 4, 2026 13:38
adamziel added a commit to adamziel/reprint that referenced this pull request May 4, 2026
## Summary

Picks up [wp-php-toolkit
v0.7.3](https://github.com/WordPress/php-toolkit/releases/tag/v0.7.3),
which fixed the published-package autoload regressions caught by
WordPress/php-toolkit#264. The most relevant fixes for reprint:

- data-liberation@0.7.3 now correctly declares its dependency on
wp-php-toolkit/html
- polyfill@0.7.3 no longer eagerly declares WP_Error through
autoload.files
- Various optional integrations bundled in vendored Symfony / webuni
packages are excluded from the classmap

## Changes

- packages/reprint-exporter/composer.json: ^0.7.2 -> ^0.7.3 for
data-liberation and html
- packages/reprint-importer/composer.json: same
- composer.lock refreshed; all transitive toolkit packages resolve to
v0.7.3

## Test plan

- [x] composer update wp-php-toolkit/data-liberation wp-php-toolkit/html
resolves cleanly to v0.7.3 across all transitive packages
- [x] composer compat (PHP 7.4 compatibility) passes
- [x] ExportLibraryLoadTest and BuildPdoDsnTest pass locally
- [ ] PHPUnit matrix green on CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant